/*
 * @Description: ջ������
 * @Author: zhangbo
 * @Date: 2021-03-29 20:14:44
 * @LastEditTime: 2021-04-07 20:37:41
 * @LastEditors: zhangbo
 */

using namespace std;
template <class T>
class Stack
{
private:
    struct Node
    {
        T val;
        Node *next;
        Node() { next = nullptr; }
        Node(const T &val, Node *next) : val(val), next(next) {}
    };
    Node *top; //ջ��ָ��
    int Size;

public:
    Stack()
    {
        top = nullptr;
        Size = 0;
    }                                             //����ջ
    ~Stack() { this->Clear(); }                   //����ջ
    void Clear();                                 //���ջ
    bool empty() const { return top == nullptr; } //�п�
    int size() const;                             //�󳤶�
    void push(const T &value);                    //ѹջ
    T pop();                                      //��ջ
    T Top() const;                                //ȡջ��Ԫ��
};